﻿$processes = Get-Process
foreach ($item in $processes)
{
    if ($item.ProcessName -eq "ADSafe")
        {
            Write-Host ($item.ws/1024)
        }
}

#mail server configuration
$smtpServer = "smtp.qq.com"
$smtpUser = "184759758"
$smtpPassword = "q13752560473q"

#create the mail message
$mail = New-Object System.Net.Mail.MailMessage

#set the addresses
$MailAddress="184759758@qq.com"
$MailtoAddress="184759758@qq.com"
$mail.From = New-Object System.Net.Mail.MailAddress($MailAddress)
$mail.To.Add($MailtoAddress)

#set the content
$mail.Subject = "Hello PowerShell";
$mail.Priority  = "High"
$mail.Body = "Sending mail is easy!"
#$filename="E:\Vidown\幸运星K歌全集.flv"
#$attachment = new-Object System.Net.Mail.Attachment($filename)
#$mail.Attachments.Add($attachment)


#send the message
$smtp = New-Object System.Net.Mail.SmtpClient -argumentList $smtpServer
$smtp.Credentials = New-Object System.Net.NetworkCredential -argumentList $smtpUser,$smtpPassword
$smtp.Send($mail)
